﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="EditComments.aspx.cs" Inherits="AdminSite.Pages.Deals.EditComments" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Edit Comments - Deal id: <%:Request.QueryString["id"] %>
    </h2>
        <h3>
        <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Pages/Deals/Deals.aspx">Back...</asp:HyperLink></h3>
    <hr />
    <div style="margin-top:15px;margin-bottom:20px;float:left">
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="Id" 
            DataSourceID="EntityDataSourceComments" ShowFooter="True">
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:BoundField DataField="Data" HeaderText="Data" SortExpression="Data" />
                <asp:TemplateField HeaderText="Texto" SortExpression="Texto">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Height="83px" 
                            Text='<%# Bind("Texto") %>' Width="189px"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("Texto") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:CheckBoxField DataField="IsAdmin" HeaderText="IsAdmin" 
                    SortExpression="IsAdmin" />
                <asp:TemplateField HeaderText="Client Name">
                    <EditItemTemplate>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("Cliente.Nome") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ConvertEmptyStringToNull="False" HeaderText="Client Picture">
                    <EditItemTemplate>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Image ID="Image1" runat="server" Height="56px" 
                            ImageUrl='<%# Eval("Cliente.UriImagem") %>' Width="71px" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:EntityDataSource ID="EntityDataSourceComments" runat="server" 
            ConnectionString="name=GrupyzEntities" DefaultContainerName="GrupyzEntities" 
            EnableDelete="True" EnableFlattening="False" EnableInsert="True"  Include="Cliente"
            EnableUpdate="True" EntitySetName="Comentario" OrderBy="it.data desc" 
            Where="it.dealid = @id" EntityTypeFilter="">
            <WhereParameters>
                <asp:QueryStringParameter DbType="Int32" DefaultValue="0" Name="id" 
                    QueryStringField="id" />
            </WhereParameters>
        </asp:EntityDataSource>
    </div>
    <div style="margin-left:15px;float:left">
    <h2>Add comment</h2>
    <hr />
    <div>Text: </div>
    <div>
        <asp:TextBox ID="txtComment" runat="server" Height="76px" Width="215px"></asp:TextBox>
        </div>
    <p <div style="margin-left:55px;">
        <asp:Button ID="Button1" runat="server" Text="Submit" onclick="Button1_Click" /></p>
    </div>
</asp:Content>
